package org.jeecg.modules.demo.crm.mapper;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.crm.entity.CCompanyInfoDetails;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 总包主体余额记录
 * @Author: jeecg-boot
 * @Date:   2025-06-24
 * @Version: V1.0
 */
public interface CCompanyInfoDetailsMapper extends BaseMapper<CCompanyInfoDetails> {

    @Select("select * from c_company_info_details where request_id = #{requestId}")
    CCompanyInfoDetails findByRequestId(@Param("requestId") String requestId);


    @Select("select * from c_company_info_details where record_id = #{recordId}")
    CCompanyInfoDetails findByRecordId(@Param("recordId") String recordId);

    @Select("select IFNULL(sum(amount),0) from c_company_info_details where company_id = #{companyId}")
    BigDecimal companyAmount(@Param("companyId")String companyId);

    @Delete("delete from c_company_info_details where record_id = #{recordId}")
    void deleteByRecordId(@Param("recordId")String recordId);

    @Delete("delete from c_company_info_details where request_id = #{requestId}")
    void deleteByRequestId(@Param("requestId")String requestId);
}
